package com.xzan.medusaweb.basicdesign.test.observer;

import java.util.Enumeration;
import java.util.Vector;

public abstract class AbstractSubject implements Subject {
    private Vector<Observer> vector=new Vector<Observer>();
    @Override
    public void add(Observer observer) {
        vector.add(observer);

    }

    @Override
    public void notifyAllObservers() {
        if (vector.size()>0){
            Enumeration<Observer> enumeration=vector.elements();
            while (enumeration.hasMoreElements()){
                enumeration.nextElement().update();
            }
        }

    }

    @Override
    public void del(Observer observer) {
        vector.remove(observer);

    }

    @Override
    public void operation() {

    }
}
